package com.xms.datacore;

import com.xms.core.exception.XmsException;
import com.xms.schema.entity.Attribute;
import com.xms.schema.entity.Entity;
import com.xms.schema.entity.RelationShip;

import java.sql.SQLException;
import java.util.List;

/**
 * <p>
 * IMetadataProvider
 * </p>
 *
 * @author migo
 * @since 2021/8/31
 */
public interface IMetadataProvider {
    void addColumn(Attribute... attributes) throws XmsException, SQLException;

    void alterColumn(Attribute... attributes) throws SQLException;

    void alterView(Entity entity, List<Attribute> attributes, List<RelationShip> relationShips) throws SQLException;

    void createView(Entity entity, List<Attribute> attributes, List<RelationShip> relationShips) throws SQLException;

    void createTable(Entity entity, List<Attribute> defaultAttributes) throws SQLException;

    void dropColumn(Attribute... attributes) throws SQLException;

    void dropTable(Entity entity) throws SQLException;

    void dropView(Entity entity) throws SQLException;

    void dropView(String name) throws SQLException;

    boolean tableExists(String table) throws SQLException;

    boolean viewExists(String name) throws SQLException;

    boolean columnExists(String table, String column) throws SQLException;
}
